with Ada.Text_Io; use Ada.Text_Io;
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
with Enters_Protegits; use Enters_Protegits;

procedure Enters_Protegits_Test is
  
  E: Enter_Protegit;

  task type T(Voltes: Positive);
  
  task body T is
    X: Integer;
  begin
    for I in 1..Voltes loop
      Increment(E);
--      X := Get(E);
--      X := X + 1;
--      Set(E, X);
    end loop;
  end T;

  Num_Tasques: Positive;
  Num_Voltes: Positive;
begin
  Put("Nombre de tasques? "); Get(Num_Tasques);
  Put("Nombre de voltes?  "); Get(Num_Voltes);
  declare
    type P_T is access T;
    P: P_T;
  begin
    for I in 1..Num_Tasques loop
      P := new T(Num_Voltes);
    end loop;
  end;
  Put("Teoric: "); Put(Num_Tasques * Num_Voltes, Width => 0);
  New_Line;
  Put("Real:   "); Put(Get(E), Width => 0);
end Enters_Protegits_Test;
